﻿@{
    ViewBag.Title = "审批流管理";
    Layout = "~/Areas/Admin/Views/Shared/_Layout.cshtml";
}
<div class="layui-tab layui-tab-brief" lay-filter="user">
    <div class="layui-form layui-tab-content" id="LAY_ucm" style="padding: 5px 0;">
        <div class="layui-tab-item layui-show">
            <form action="" class="layui-form">
                <div class="layui-form-item" style="margin: 10px 0 0;">
                    <div class="addItem"><a class="layui-btn" lay-href="/Admin/CustomForm/Create">添加节点</a></div>
                </div>
            </form>

            <table class="layui-table" lay-data="{url:'GetData?keyword=@ViewBag.Keyword', cellMinWidth: 80, page: false,limit:200}" lay-filter="userList">
                <thead>
                    <tr>
                        <th lay-data="{field:'ID', width:80}">ID</th>
                        <th lay-data="{field:'Name'}">名称</th>
                        <th lay-data="{field:'Sort'}">排序</th>
                        <th lay-data="{fixed:'right', width:260, align:'center', toolbar: '#barDemo'}">操作</th>
                    </tr>
                </thead>
            </table>


            <script type="text/html" id="barDemo">
                <a class="layui-btn layui-btn-primary layui-btn-xs" lay-href="/Admin/CustomForm/ShowProcess?id={{d.ID}}" lay-data="{{d}}">查看审批流</a>
                <a class="layui-btn layui-btn-primary layui-btn-xs" lay-href="/Admin/CustomForm/Edit?id={{d.ID}}" lay-data="{{d}}">修改</a>
                <a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="delete" lay-data="{{d}}">删除</a>
            </script>

        </div>
    </div>
</div>
<script type="text/javascript">
    var deleteConfirmMsg = "您真的要删除当前记录吗?";
    layui.config({
        base: '/Content/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use('index');
    layui.use('table', function () {
        var table = layui.table;
        //监听单元格事件
        table.on('tool(userList)', function (obj) {
            var data = obj.data;
            var title = "";
            if (obj.event === 'delete') {
                layer.confirm('您正在进行删除流程树操作', {
                    btn: ['是的,我要删除单页分组', '不小心点错了'] //按钮
                }, function () {
                    var url = "/Admin/CustomForm/Delete?id=" + data.ID;
                    $.getJSON(url, function (data) {
                        if (data.State === 200) {
                            window.location.href = window.location.href;
                        }
                        else {
                            layer.msg(data.Message);
                        }
                    });
                }, function () {

                });
            }

        });
    });

</script>


